package com.mall.service.impl;
import com.mall.mapper.ActityMapper;
import com.mall.po.Activity;
import com.mall.service.ActityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author zhanghui
 * @ClassName ActivityServiceImpl
 * @Description TODO
 * @Date 2021/1/6 17:16
 * @Version 1.0
 **/
@Service
public class ActivityServiceImpl implements ActityService{
@Autowired
private ActityMapper actityMapper;
    @Override
    public Activity findActityByName(String goodsname) {
        return actityMapper.selectActityByGoodsname(goodsname);
    }

    @Override
    public int addActity(Activity activity) {
        return actityMapper.insertActity(activity);
    }

    @Override
    public int updateActity(Activity activity) {
        return actityMapper.updateActity(activity);
    }

    @Override
    public int deleteActity(int activitysid) {
        return actityMapper.deleteActity(activitysid);
    }
/**
 * @Author zhanghui
 * @Description 批量删除
 * @Date 2021/1/7 14:20
 * @Param [activitysids]
 * @return boolean
 **/
    @Override
    public boolean deleteActityList(Integer[] activitysids) {
        if(actityMapper.deleteActityList(activitysids)){
            return true;
        }
        return false;
    }
/**
 * @Author zhanghui
 * @Description 分页查询活动
 * @Date 2021/1/7 15:31
 * @Param [page, pagesize]
 * @return java.util.List<com.mall.po.Activity>
 **/
    @Override
    public List<Activity> findActivityList(int page, int pagesize) {
        return actityMapper.selectAllActity((page-1)*pagesize,pagesize);
    }
}
